close all;
clear all;
load 'data1.mat'
[a,b]=size(data1);
for i=1:a
    position(i,1)=data1(i,2)*sind(data1(i,1));
    position(i,2)=data1(i,2)*cosd(data1(i,1));
end
correct_p=double.empty(0,2);
[p32,distance32,mean32,F32,liyi32_index,duan32_index]=differ(position(1:32,:));
[p64,distance64,mean64,F64,liyi64_index,duan64_index]=differ(position(33:64,:));
[p96,distance96,mean96,F96,liyi96_index,duan96_index]=differ(position(65:96,:));
[p128,distance128,mean128,F128,liyi128_index,duan128_index]=differ(position(97:128,:));
[p160,distance160,mean160,F160,liyi160_index,duan160_index]=differ(position(129:160,:));
[p192,distance192,mean192,F192,liyi192_index,duan192_index]=differ(position(161:192,:));
[p224,distance224,mean224,F224,liyi224_index,duan224_index]=differ(position(193:224,:));
[p256,distance256,mean256,F256,liyi256_index,duan256_index]=differ(position(225:256,:));
[TP,Tdistance,Tmean,TF,liyi_index,duan_index]=differ(position(1:256,:));
[correct_p32]=dividep(liyi32_index,duan32_index,p32);
[correct_p64]=dividep(liyi64_index,duan64_index,p64);
[correct_p96]=dividep(liyi96_index,duan96_index,p96);
[correct_p128]=dividep(liyi128_index,duan128_index,p128);
[correct_p160]=dividep(liyi160_index,duan160_index,p160);
[correct_p192]=dividep(liyi192_index,duan192_index,p192);
[correct_p224]=dividep(liyi224_index,duan224_index,p224);
[correct_p256]=dividep(liyi256_index,duan256_index,p256);
correct_p=[correct_p32;correct_p64;correct_p96;correct_p128;correct_p160;correct_p192;correct_p224;correct_p256];


%%  show 
figure 
subplot(3,3,1)
scatter(p32(:,1),p32(:,2),'x');
axis([-5,2,-2,6])
subplot(3,3,2)
scatter(p64(:,1),p64(:,2),'x');
axis([-5,2,-2,6])
subplot(3,3,3)
scatter(p96(:,1),p96(:,2),'x');
axis([-5,2,-2,6])
subplot(3,3,4)
scatter(p128(:,1),p128(:,2),'x');
axis([-5,2,-2,6])
subplot(3,3,5)
scatter(p160(:,1),p160(:,2),'x');
axis([-5,2,-2,6])
subplot(3,3,6)
scatter(p192(:,1),p192(:,2),'x');
axis([-5,2,-2,6])
subplot(3,3,7)
scatter(p224(:,2),p224(:,1),'x');
axis([-5,2,-2,6])
subplot(3,3,8)
scatter(p256(:,1),p256(:,2),'x');
axis([-5,2,-2,6])
subplot(3,3,9)
scatter(TP(:,1),TP(:,2),'x');
axis([-5,2,-2,6])
% % 
% figure 
% [c32,d32]=size(distance32);
% [c64,d64]=size(distance64);
% [c96,d96]=size(distance96);
% [c128,d128]=size(distance128);
% [c160,d160]=size(distance160);
% [c192,d192]=size(distance192);
% [c224,d224]=size(distance224);
% [c256,d256]=size(distance256);
% [Tc,Td]=size(Tdistance);
% t32=1:1:d32;
% t64=1:1:d64;
% t96=1:1:d96;
% t128=1:1:d128;
% t160=1:1:d160;
% t192=1:1:d192;
% t224=1:1:d224;
% t256=1:1:d256;
% t=1:1:Td;
% subplot(3,3,1)
% plot(t32,distance32,'x');
% hold on
% plot(t32,mean32);
% hold off
% subplot(3,3,2)
% plot(t64,distance64,'x');
% hold on;
% plot(t64,mean64);
% hold off
% subplot(3,3,3)
% plot(t96,distance96,'x');
% hold on;
% plot(t96,mean96);
% hold off
% subplot(3,3,4)
% plot(t128,distance128,'x');
% hold on;
% plot(t128,mean128);
% hold off
% subplot(3,3,5)
% plot(t160,distance160,'x');
% hold on;
% plot(t160,mean160);
% hold off
% subplot(3,3,6)
% plot(t192,distance192,'x');
% hold on;
% plot(t192,mean192);
% hold off
% subplot(3,3,7)
% plot(t224,distance224,'x');
% hold on;
% plot(t224,mean224);
% hold off
% subplot(3,3,8)
% plot(t256,distance256,'x');
% hold on;
% plot(t256,mean256);
% hold off
% subplot(3,3,9)
% plot(t,Tdistance,'x');
% hold on;
% plot(t,Tmean);
% hold off

figure 
subplot(3,3,1)
plot(p32(:,1),p32(:,2));
axis([-5,2,-2,6])
subplot(3,3,2)
plot(p64(:,1),p64(:,2));
axis([-5,2,-2,6])
subplot(3,3,3)
plot(p96(:,1),p96(:,2));
axis([-5,2,-2,6])
subplot(3,3,4)
plot(p128(:,1),p128(:,2));
axis([-5,2,-2,6])
subplot(3,3,5)
plot(p160(:,1),p160(:,2));
axis([-5,2,-2,6])
subplot(3,3,6)
plot(p192(:,1),p192(:,2));
axis([-5,2,-2,6])
subplot(3,3,7)
plot(p224(:,2),p224(:,1));
axis([-5,2,-2,6])
subplot(3,3,8)
plot(p256(:,1),p256(:,2));
axis([-5,2,-2,6])
subplot(3,3,9)
plot(TP(:,1),TP(:,2));
axis([-5,2,-2,6])

figure
subplot(3,3,1)
plot(correct_p32(:,1),correct_p32(:,2));
axis([-5,2,-2,6])
subplot(3,3,2)
plot(correct_p64(:,1),correct_p64(:,2));
axis([-5,2,-2,6])
subplot(3,3,3)
plot(correct_p96(:,1),correct_p96(:,2));
axis([-5,2,-2,6])
subplot(3,3,4)
plot(correct_p128(:,1),correct_p128(:,2));
axis([-5,2,-2,6])
subplot(3,3,5)
plot(correct_p160(:,1),correct_p160(:,2));
axis([-5,2,-2,6])
subplot(3,3,6)
plot(correct_p192(:,1),correct_p192(:,2));
axis([-5,2,-2,6])
subplot(3,3,7)
plot(correct_p224(:,2),correct_p224(:,1));
axis([-5,2,-2,6])
subplot(3,3,8)
plot(correct_p256(:,1),correct_p256(:,2));
axis([-5,2,-2,6])
subplot(3,3,9)
plot(correct_p(:,1),correct_p(:,2));
axis([-5,2,-2,6])

figure
scatter(TP(:,1),TP(:,2),'x');
axis([-5,2,-2,6])

figure
scatter(correct_p(:,1),correct_p(:,2),'x');
axis([-5,2,-2,6])




